package com.bhdx.blog.service.impl;

/**
 * @author bhdx
 * @date 2020/6/16-15:16
 */

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import com.bhdx.blog.dao.BlogDao;
import com.bhdx.blog.entity.Blog;
import com.bhdx.blog.entity.PageBean;
import com.bhdx.blog.service.BlogService;
import org.springframework.stereotype.Service;

/**
 * 博客service实现类
 */

//@Service("blogService")
    @Service("blogService")
public class BlogServiceImpl implements BlogService {

    @Resource
    private BlogDao blogDao;

//    public PageBean<Blog> listBlog(String title, PageBean<Blog> pageBean) {
//        Map<String,Object> map = new HashMap<String,Object>();
//        //设置查询条件
//        map.put("title",title);
//        //总记录放入pageBean
//        pageBean.setTotal(blogDao.getTotal(map));
//        map.put("start",pageBean.getStart());
//        map.put("end",pageBean.getEnd());
//        //把分页结果放入pageBean
//        pageBean.setResult(blogDao.listBlog(map));
//        return pageBean;
//    }



    public List<Blog> getBlogData() {
        return blogDao.getBlogData();
    }

    public List<Blog> listBlog(Map<String,Object> map) {
        return blogDao.listBlog(map);
    }

    public Integer getBlogByTypeId(Integer typeId) {
        return blogDao.getBlogByTypeId(typeId);
    }

    public Integer saveBlog(Blog blog) {
        return blogDao.saveBlog(blog);
    }

    public Integer updateBlog(Blog blog) {
        return blogDao.updateBlog(blog);
    }

    public Integer deleteBlog(Integer id) {
        return blogDao.deleteBlog(id);
    }

    public Blog getById(Integer id) {
        return blogDao.getById(id);
    }

    public Long getTotal(Map<String, Object> map) {
        return blogDao.getTotal(map);
    }

    @Override
    public Blog getPrevBlog(Integer id) {
        return blogDao.getPrevBlog(id);
    }

    @Override
    public Blog getNextBlog(Integer id) {
        return blogDao.getNextBlog(id);
    }

}

